package com.work.straighttalk.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.chat.EMTextMessageBody;
import com.rockerhieu.emojicon.EmojiconTextView;
import com.work.straighttalk.R;
import com.work.straighttalk.bean.StraightTalkMessage;

import butterknife.Bind;

/**
 * Created by dllo on 16/3/4.
 */
public class ReceiveTextHolder extends BaseViewHolder<StraightTalkMessage> {
    @Bind(R.id.tv_time)
    TextView tvTime;
    @Bind(R.id.iv_avatar)
    SimpleDraweeView ivAvatar;
    @Bind(R.id.tv_message)
    EmojiconTextView tvMessage;
    private OnRecyclerViewClickListener listener;


    public ReceiveTextHolder(Context context, ViewGroup root, OnRecyclerViewClickListener listener) {
        super(context, root, R.layout.item_chat_receive);
        this.listener = listener;
    }

    @Override
    public void bindData(StraightTalkMessage message) {
        EMMessage emMessage = message.getEmMessage();
        EMTextMessageBody body = (EMTextMessageBody) emMessage.getBody();
        tvTime.setText(emMessage.getMsgTime() + "");
        tvMessage.setText(body.getMessage());
    }
}
